package modelLayer;

import java.util.ArrayList;

/**
 * Tree container class
 * @author Thomas
 * @version 1.0.0
 */
public class TreeContainer {

	private static TreeContainer instance;
	private ArrayList<Tree> treeList;
	
	public TreeContainer() {
		treeList = new ArrayList<Tree>();
	}
	
	/**
	 * singleton
	 * @return instance
	 */
	public static TreeContainer getInstance() {
		if(instance == null) {
			instance = new TreeContainer();
		}
		return instance;
	}
	/**
	 * Returns the objects of the ArrayList
	 * @return treeList
	 */
	public ArrayList<Tree> getTrees() {
		return treeList;
	}
	
	/**
	 * Adds tree object to the ArrayList
	 * @param tree
	 */
	public void addTree(Tree tree) {
		treeList.add(tree);
	}
	
	/**
	 * returns a tree object
	 * @param index
	 * @return
	 */
	public Tree getTree(int index) {
		return treeList.get(index);
	}
}
